import http from '@/config/axios';
// targetStandardReport : 目标标准报告表相关操作接口
// 诊改报告-我的报告
const reportUrl = '/v1/pc/api/targetStandardReport';
// 1.01 报告管理-查询报告详情
export const getReportDetail = id => http.get(`${reportUrl}/${id}`);
// 1.06 查询我的报告
export const getMyReport = data =>
    http.get(`${reportUrl}/queryMyTargetStandardReportList`, { params: data });
// 1.04 报告管理卡片数据
export const getReportManageList = data =>
    http.get(`${reportUrl}/queryTargetStandardReportList`, { params: data });
// 1.08 获取生成报告-报告名称
export const getReportNameById = params =>
    http({
        url: '/v1/pc/api/targetStandardReport/getReportNameById',
        params,
        method: 'get'
    });

// 1.09 获取生成报告-专业名称
export const getProfessionalById = () =>
    http({
        url: '/v1/pc/api/targetStandardReport/getProfessionalById',
        method: 'get'
    });

// 1.11 获取生成报告-Course报告名称
export const getCourseReportNameById = data =>
    http.get('/v1/pc/api/targetStandardReport/getCourseReportNameById', {
        params: data
    });
// 1.12 获取生成报告-Course报告名称
export const getCourseSpecializedReportNameById = data =>
    http.get(
        '/v1/pc/api/targetStandardReport/getCourseSpecializedReportNameById',
        { params: data }
    );

// 1.18 修改状态
export const editProhibitStatus = (data, status) => http({
    url: `/v1/pc/api/targetStandardReport/editProhibitStatus?status=${status}`,
    method: 'post',
    data
})
// 2.01 生成报告
export const createReport = data => http.post(`${reportUrl}`, data);

// 2.09 条件分页查询
export const conditionalPaginations = (data = {}) => http({
    url: '/v1/pc/api/targetStandardReport/conditionalPaginations',
    method: 'post',
    data
})
// 3.01 修改我的报告
export const updateReport = (id, data) =>
    http.patch(`${reportUrl}/${id}`, data);
// 4.01 删除数据
export const delTarget = id =>
    http({
        url: `/v1/pc/api/targetStandardReport/${id}`,
        method: 'DELETE'
    });
// 上传文件
export const uploadFile = param =>
    http.post('/v1/pc/api/file/fileUpload', param, {
        headers: { 'content-type': 'multipart/form-data' }
    });

// 上传report模块文件和文件导出
export const uploadImg = (id, data) =>
    http({
        url: `/v1/pc/api/targetStandardReport/checkPublicReport?id=${id}`,
        data,
        method: 'post',
        responseType: 'blob'
    });

// 上传报告
export const uploadReport = (data, id) =>
    http.post(`/v1/pc/api/targetStandardReport/uploadReport?id=${id}`, data, {
        headers: {
            'content-type': 'multipart/form-data'
        }
    });

// 在线查看
export const onlinePreviewReport = id =>
    http({
        url: `${id}`,
        method: 'get'
    });

// 下载报告word/pdf格式
export const downloadReport = data =>
    http({
        url: '/v1/pc/api/targetStandardReport/download/PublicReport',
        data,
        method: 'post',
        responseType: 'blob'
    });

// 线下报告维护
// export const
// 1.05 报告审核卡片数据
export const getReportCheckList = data =>
    http.get(`${reportUrl}/queryExamineTargetStandardReportList`, {
        params: data
    });

// 1.18 检验是否有对应报告权限
export const getChecker = params =>
    http({
        url: '/v1/pc/api/targetStandardReport/getChecker',
        method: 'get',
        params
    });

// 2.02 提交报告审核申请
export const reportCheckApply = data =>
    http.post(`${reportUrl}/addExamineReport`, data);
// 2.03 提交报告审核
export const checkReport = data =>
    http.post(`${reportUrl}/addExamineResultReport`, data);
// 2.04 发布报告改变报告状态为审核通过
export const publicReport = data =>
    http.post(`${reportUrl}/addPublicReport`, data);
// 2.08 导出word
export const exportWord = (id, data) =>
    http({
        url: `/v1/pc/api/targetStandardReport/exportWord?id=${id}`,
        data,
        method: 'post',
        responseType: 'blob'
    });
// 1.10 获取生成报告-专业名称
export const getReviewer = reportType =>
    http({
        url: `/v1/pc/api/targetStandardReport/getReviewer?reportType=${reportType}`,
        method: 'get'
    });
// 线下维护报告
export const getMaintenance = data =>
    http.get('/v1/pc/api/org/queryAll', { params: data });

// 获取线下报告维护数据
export const getOfflineReport = data =>
    http.get('/v1/pc/api/reportFileInfo', { params: data });

// 获取报告层面枚举数据 w
export const getReportIndexEnum = data =>
    http.get('/v1/pc/api/reportFileInfo/queryTargetStandardReportLevel', {
        params: data
    });

// 保存线下报告维护
export const saveReportMaintain = data =>
    http.post('/v1/pc/api/reportFileInfo', data);

// 删除线下报告
export const delectReoprt = id =>
    http.delete('/v1/pc/api/reportFileInfo/' + id);
export const delectBatchReoprt = data =>
    http.delete(
        '/v1/pc/api/reportFileInfo/deleteReportFileInfoBatch?ids=' + data
    );

// 评价列表
const assessUrl = '/v1/pc/api/targetStandardAssess';
// 1.04 查询报告评价列表
export const getAssessList = data =>
    http.get(`${assessUrl}/queryReportAssessList`, { params: data });
// 2.01 添加评价
export const addAssess = data => http.post(`${assessUrl}`, data);

// 诊改报告开放编辑周期信息
// 1.01 主键查询
export const targetStandardReportEditCycle = id =>
    http({
        url: `/v1/pc/api/targetStandardReportEditCycle/${id}`,
        method: 'get'
    });

// 1.02 分页查询
export const targetStandardReportEditCycleParams = params =>
    http({
        url: '/v1/pc/api/targetStandardReportEditCycle',
        method: 'get',
        params
    });

// 1.03 查询所有
export const queryAll = params =>
    http({
        url: '/v1/pc/api/targetStandardReportEditCycle/queryAll',
        method: 'get',
        params
    });

// 1.04 条件分页查询
export const queryLimit = params =>
    http({
        url: '/v1/pc/api/targetStandardReportEditCycle/queryLimit',
        method: 'get',
        params
    });
// 2.01 数据新增
export const targetStandardReportEditCycleData = data =>
    http({
        url: '/v1/pc/api/targetStandardReportEditCycle',
        method: 'post',
        data
    });

// 3.01 部分修改
export const targetStandardReportEditCycleId = (id, data) =>
    http({
        url: `/v1/pc/api/targetStandardReportEditCycle/${id}`,
        method: 'patch',
        data
    });

// 4.01 删除数据
export const targetStandardReportEditCycleDel = id =>
    http({
        url: `/v1/pc/api/targetStandardReportEditCycle/${id}`,
        method: 'delete'
    });

// dictVal : 条目明细表相关操作接口
// 1.01 查询层面code
export const getLevelCode = () =>
    http({
        url: '/v1/pc/api/dictVal/getLevelCode',
        method: 'get'
    });

// 1.14 获取专业层报告名字
export const getProfessionalByIds = params =>
    http({
        url: '/v1/pc/api/targetStandardReport/getProfessionalByIds',
        method: 'get',
        params
    });

// 1.15 获取专业层诊改专业
export const getDiagnosiaReform = params =>
    http({
        url: '/v1/pc/api/targetStandardReport/getDiagnosiaReform',
        method: 'get',
        params
    });
